var list = document.querySelector('#bannerlist');
var liHeight = 0;
var itemCount = 3;
function init() {
  for (var i = 0; i < itemCount; i++) {
    var li = document.createElement('li');
    li.className = 'item';
    li.innerText = '我是第' + i + '项';
    list.appendChild(li);
  }

  var firstItem = list.children[0].cloneNode(true);
  list.appendChild(firstItem);

  liHeight = firstItem.offsetHeight;

  startScoll();
}

var curIndex = 0;
function startScoll() {
  //   if (curIndex == itemCount) {
  //     console.log('object');
  //     curIndex = 0;
  //     list.style.marginTop = 0;
  //   }
  setInterval(() => {
    curIndex++;
    list.style = curIndex * liHeight;
  }, 1000);
}

init();
